home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 9
/
The PC-SIG Library on CD ROM - Ninth Edition.iso
/
1501_600
/
DISK1533
/
DISK1533.ZIP
/
ENLARGE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-05-09
|
6KB
|
116 lines
#include <ctype.h>
#include <stdio.h>
#define FALSE 0
#define TRUE 1
#define CHARSET 56 /* characters to print */
#define ROWSIZE 10 /* Rows per character */
#define COLSIZE 9 /* Columns per character */
#define MAXMSG 8 /* Max bytes for a msg */
#define ENDLIST 44 /* last character= 43 */
#define DASHPOS 10 /* position of hyphen */
struct Sym {
int iPos; /* position in table */
char cSymbol; /* symbol to draw with */
char * pcSwitch [ROWSIZE];
} Symbols [] = {
0, '0', { "3-7", "2-8", "1289", "1289", "1289", "1289", "1289", "1289", "2-8", "3-7" },
1, '1', { "56", "4-6", "2-6", "56", "56", "56", "56", "56", "1-9", "1-9" },
2, '2', { "2-8", "1-9", "1289", "78", "67", "56", "45", "34", "2-9", "1-9" },
3, '3', { "2-8", "1-9", "1289", "78", "4-7", "4-7", "78", "1289", "1-9", "2-8" },
4, '4', { "5-9", "4-9", "3489", "2389", "1289", "1-9", "1-9", "89", "89", "89" },
5, '5', { "1-9", "1-9", "12", "12", "1-8", "2-9", "89", "1289", "1-9", "2-8" },
6, '6', { "2-8", "1-9", "1289", "12", "1-8", "1-9", "1289", "1289", "1-9", "2-8" },
7, '7', { "2-8", "1-9", "1289", "89", "89", "78", "67", "56", "45", "34" },
8, '8', { "3-7", "2-8", "1289", "1289", "2-8", "3-7", "1289", "1289", "2-8", "3-7" },
9, '9', { "2-8", "1-9", "1289", "1289", "1-9", "2-9", "89", "1289", "1-9", "2-8" },
10, '-', { "B", "B", "B", "B", "1-9", "1-9", "B", "B", "B", "B" },
11, '#', { "2378", "2378", "1-9", "1-9", "2378", "2378", "1-9", "1-9", "2378", "2378" },
12, 'A', { "4-6", "3467", "2378", "1289", "1289", "1-9", "1-9", "1289", "1289", "1289" },
13, 'B', { "1-8", "1-9", "1289", "1289", "1-8", "1-8", "1289", "1289", "1-9", "1-8" },
14, 'C', { "2-8", "1-9", "1289", "12", "12", "12", "12", "1289", "1-9", "2-8" },
15, 'D', { "1-8", "1-9", "1289", "1289", "1289", "1289", "1289", "1289", "1-9", "1-8" },
16, 'E', { "1-9", "1-9", "12", "12", "1-6", "1-6", "12", "12", "1-9", "1-9" },
17, 'F', { "1-9", "1-9", "12", "12", "1-6", "1-6", "12", "12", "12", "12" },
18, 'G', { "2-8", "1-9", "1289", "12", "12", "126-9", "126-9", "1289", "1-9", "2-8" },
19, 'H', { "1289", "1289", "1289", "1289", "1-9", "1-9", "1289", "1289", "1289", "1289" },
20, 'I', { "3-8", "3-8", "56", "56", "56", "56", "56", "56", "3-8", "3-8" },
21, 'J', { "89", "89", "89", "89", "89", "89", "89", "1289", "2-8", "3-7" },
22, 'K', { "1289", "1278", "1267", "1256", "1245", "1-5", "1256", "1267", "1278", "1289" },
23, 'L', { "12", "12", "12", "12", "12", "12", "12", "12", "1-9", "1-9" },
24, 'M', { "19", "1289", "1-37-9", "1-46-9", "124-689", "12589", "1289", "1289", "1289", "1289" },
25, 'N', { "189", "1289", "1-389", "1-489", "124589", "125689", "126-9", "127-9", "1289", "129" },
26, 'O', { "2-8", "1-9", "1289", "1289", "1289", "1289", "1289", "1289", "1-9", "2-8" },
27, 'P', { "1-8", "1-9", "1289", "1289", "1-9", "1-8", "12", "12", "12", "12" },
28, 'Q', { "2-8", "1-9", "1289", "1289", "1289", "1289", "125689", "126-9", "1-9", "2-8" },
29, 'R', { "1-8", "1-9", "1289", "1289", "1-9", "1-8", "1256", "1267", "1278", "1289" },
30, 'S', { "2-8", "1-9", "1289", "23", "34", "56", "67", "1278", "1-9", "2-8" },
31, 'T', { "2-9", "2-9", "56", "56", "56", "56", "56", "56", "56", "56" },
32, 'U', { "1289", "1289", "1289", "1289", "1289", "1289", "1289", "1289", "2-8", "3-7" },
33, 'V', { "1289", "1289", "1289", "1289", "1289", "1289", "1289", "2378", "3467", "4-6" },
34, 'W', { "1289", "1289", "1289", "1289", "12589", "124-689", "1-46-9", "1-37-9", "1289", "19" },
35, 'X', { "1289", "1289", "1289", "2378", "3-7", "4-6", "2378", "1289", "1289", "1289" },
36, 'Y', { "1289", "1289", "1289", "1289", "2378", "4-6", "45", "45", "45", "45" },
37, 'Z', { "1-9", "1-9", "78", "67", "56", "45", "34", "23", "1-9", "1-9" },
38, '.', { "B", "B", "B", "B", "B", "B", "3-7", "3-7", "3-7", "3-7" },
39, ':', { "3-7", "3-7", "3-7", "3-7", "B", "B", "3-7", "3-7", "3-7", "3-7" },
40, ';', { "3-7", "3-7", "3-7", "3-7", "B", "3-7", "3-7", "5-7", "56", "45" },
41, ',', { "B", "B", "B", "B", "B", "3-7", "3-7", "5-7", "56", "45" },
42, '%', { "2-489", "124589", "124589", "2-478", "67", "45", "236-8", "125689", "125689", "126-8" },
43, ' ', { "1-9", "1-9", "1-9", "1-9", "1-9", "1-9", "1-9", "1-9", "1-9", "1-9" }
};
void enlarge(char * szMsg)
{
int i, j;
char *CurChar;
char * expand(int, int);
for (j = 0; j < ROWSIZE; j++) { /* rows to expand ... */
putchar ('\n');
for (CurChar = szMsg; *CurChar != '\0'; CurChar++) {
for (i = 0; i < ENDLIST; i++)
if (Symbols[i].cSymbol == *CurChar)
break;
if (i == ENDLIST)
i = DASHPOS;
fprintf(stdout, "%9s ", expand(i, j));
}
}
}
#define SPACE ' '
#define HYPHEN '-'
static char szOutput [COLSIZE];
char * expand (int i, int j)
{
char sOutput [COLSIZE];
char *s;
char sym = Symbols[i].cSymbol;
int indx, iCur;
for (indx=0; indx < COLSIZE; indx++)
sOutput [indx] = SPACE;
sOutput[COLSIZE] = '\0'; /* terminator is required */
for ( s = Symbols[i].pcSwitch[j]; *s != '\0'; s++) {
if (isdigit (*s))
sOutput[*(s) - '0' - 1] = sym;
else if (*s == HYPHEN) {
for (iCur = *(s-1) - '0'; iCur <= *(s+1) - '0'; iCur++)
sOutput[iCur-1] = sym;
s++;
}
} /* for block is closed -- until string is null */
strcpy (szOutput, sOutput);
return szOutput;
}